﻿using AutoMapper;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Traceability_2203.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TextsController : ControllerBase
    {


        private 
            readonly IMapper mapper;

        public TextsController(IMapper mapper)
        {
            this.mapper = mapper;
        }

        [HttpGet]


        public void GetValues()
        {
            var people = new Peole() { userid = 1, name = "张三", Age = 18, BirhDaet = new DateTime(2021, 1, 5), Weight = 170.2m, Car = new IDCardDto() { IDcard = "123123123123" } };

            var person=mapper.Map<Person>(people);
        }
    }


    public class Peole()
    {

        public int userid {  get; set; }

        public string name { get; set; }

        public int Age {  get; set; }

        public  DateTime BirhDaet {  get; set; }

        public decimal Weight {  get; set; }

        public IDCardDto Car { get; set; }
    }





    public class IDCardDto
    {



        public string IDcard
        {
            get; set;
        }
    }
        public class Person()
        {
            public int userid { get; set; }

            public string UserName { get; set; }

            public int UserAge { get; set; }


            public string BirDate { get; set; }

            public int Weidht { get; set; }


            public string CardIDCard { get; set; }

        }

    
}
